Skip to content

获取软件更新状态 - GetSoftUpdateStatus

函数简介

获取客户端软件更新状态,并返回最新版本业务信息。

返回数据格式:

json
{
  "Code": 1,
  "Message": "",
  "CurrentVersion": "1.0.0",
  "LatestVersion": "1.1.0",
  "HasUpdate": true,
  "SoftVersion": {
    "SoftCode": "demo-soft",
    "VersionNumber": "1.1.0",
    "VersionName": "2026春季版",
    "VersionType": 1,
    "FileName": "demo-installer.exe",
    "FileSize": 12345678,
    "FileMd5": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "FileUrl": "https://example.com/demo-installer.exe",
    "IsForceUpdate": false,
    "UpdateContent": "修复已知问题并优化稳定性",
    "ReleaseDate": "2026-04-24 09:00:00",
    "IsLatest": true
  }
}
字段名类型说明
Code整数结果状态码,通常 1 表示成功,0 或其他值表示失败。
Message字符串提示信息或错误信息,成功时通常为空字符串。
CurrentVersion字符串当前版本号。
LatestVersion字符串最新版本号。
HasUpdate布尔是否存在可更新版本。
SoftVersion对象版本对象信息。

SoftVersion 字段说明:

字段名类型说明
SoftCode字符串软件编码。
VersionNumber字符串版本号。
VersionName字符串版本名称。
VersionType整数版本类型编码。
FileName字符串安装包文件名。
FileSize整数安装包大小(字节)。
FileMd5字符串安装包 MD5 校验值。
FileUrl字符串安装包下载地址。
IsForceUpdate布尔是否强制更新。
UpdateContent字符串更新说明内容。
ReleaseDate字符串版本发布时间。
IsLatest布尔是否为最新版本。

接口名称

GetSoftUpdateStatus

DLL调用

long GetSoftUpdateStatus(string userCode, string softCode, string softVersion, string dealerCode);

参数说明

参数名类型说明
userCode字符串用户码。
softCode字符串软件码。
softVersion字符串软件版本。
dealerCode字符串经销商码。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int ret = ola.GetSoftUpdateStatus("value", "value", "value", "value");
csharp
using OLAPlug;

var ola = new OLAPlugServer();
int ret = ola.GetSoftUpdateStatus("value", "value", "value", "value");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ret = ola.GetSoftUpdateStatus("value", "value", "value", "value")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
int ret = ola.GetSoftUpdateStatus("value", "value", "value", "value");
cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.GetSoftUpdateStatus("value", "value", "value", "value")
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.GetSoftUpdateStatus("value", "value", "value", "value")
text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.GetSoftUpdateStatus(“value”, “value”, “value”, “value”)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.GetSoftUpdateStatus("value", "value", "value", "value");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.GetSoftUpdateStatus("value", "value", "value", "value")
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int32_t ret = ola.GetSoftUpdateStatus("value", "value", "value", "value");

原生 DLL 调用

cpp
long ptr = GetSoftUpdateStatus(instance, "value", "value", "value", "value");
if (ptr != 0) {
    char buffer[512] = {0};
    GetStringFromPtr(ptr, buffer, sizeof(buffer));
    FreeStringPtr(ptr);
}
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long GetSoftUpdateStatus(string userCode, string softCode, string softVersion, string dealerCode);

long ptr = GetSoftUpdateStatus(instance, "value", "value", "value", "value");
if (ptr != 0) {
    StringBuilder sb = new StringBuilder(GetStringSize(ptr) + 1);
    GetStringFromPtr(ptr, sb, sb.Capacity);
    FreeStringPtr(ptr);
    string result = sb.ToString();
}
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ptr = ola.GetSoftUpdateStatus(instance, "value", "value", "value", "value")
if ptr:
    buf = create_string_buffer(512)
    ola.GetStringFromPtr(ptr, buf, 512)
    ola.FreeStringPtr(ptr)
    result = buf.value.decode("utf-8")

返回值

成功返回 JSON 字符串格式的更新状态结果;失败返回 0。

注意事项

  • 返回的字符串指针需要调用 FreeStringPtr 接口释放内存。
  • HasUpdate 可直接用于判断是否提示更新。